package newnes.io.memory;

/**
 *@author David Graham
 *Class to encapsulate information about an address space
 */
public final class AddressSpace {
	private int start_address;
	private int end_address;
	private int hashValue;
	
	public AddressSpace(int start_address, int end_address){
		this.start_address = start_address;
		this.end_address = end_address;
		hashValue = start_address >> 12;
	}
	
	public int getStartAddress(){
		return start_address;
	}
	
	public int getEndAddress(){
		return end_address;
	}
	
	public void setStartAddress(int address){
		this.start_address = address;
	}
	
	public void setEndAddress(int address){
		this.end_address = address;
	}
	
	public boolean isInRange(int address){
		return address <= end_address && address >= start_address;
	}
	
	public int hashCode(){
		return hashValue;
	}
}
